#include "ASPath.h"
#include "utils.h"
#include "transformations.h"

NS_AS_BEGIN

	std::vector<Vector2D> ASPath::CreateRandomPath(int   NumWaypoints,
	double MinX,
	double MinY,
	double MaxX,
	double MaxY)
{
	_WayPoints.clear();

	double midX = (MaxX+MinX)/2.0;
	double midY = (MaxY+MinY)/2.0;

	double smaller = MIN(midX, midY);

	double spacing = TwoPi/(double)NumWaypoints;

	for (int i=0; i<NumWaypoints; ++i)
	{
		double RadialDist = RandInRange(smaller*0.2f, smaller);

		Vector2D temp(RadialDist, 0.0f);

		Vec2DRotateAroundOrigin(temp, i*spacing);

		temp.x += midX; temp.y += midY;

		//_WayPoints.push_back(temp);
		AddWayPoint(temp);
	}

	//_bHasDistance = false;
	//_iIndex = 0;
	//_iSize = _WayPoints.size();
	//_curWaypoint = _WayPoints.begin();
	//_cursor = _WayPoints.begin();

	return _WayPoints;
}

NS_AS_END